#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
using namespace std;

int main() {
    string s1,s2;
    string ret;
    getline(cin, s1);
    getline(cin, s2);
    
    for(int i = 0; i < s1.size() ; i++)
    {
        if(s1[i] == ' ' || s2.find(s1[i]) == string::npos)
        {
            ret += s1[i];
        }
    }

    cout<<ret<<endl;

    return 0;
}